using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "SOBITICH", Schema="dbo")]
	[Table(Name = "[dbo].[SOBITICH]")]
	public partial class SOBITICH : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _masobitich;

		private System.Int32? _mabitich;

		private System.Guid? _nguoidodauid;

		private System.Guid? _malinhmuc;

		private System.Guid? _magiaodan;

		private System.Guid? _malopgiaoly;

		private System.String _diadiem;

		private System.String _tenlinhmuc;

		private System.String _tennguoidodau;

		private System.Int32? _ngaynhan;

		private System.Int32? _thangnhan;

		private System.Int32? _namnhan;

		private System.String _ghichu;

		private System.Int32? _maso;

		private System.Boolean? _luuso;

		private BITICH _prt_bitich;

		private LINHMUC _prt_linhmuc;

		private GIAODAN _prt_giaodan;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MASOBITICH", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MASOBITICH
		{
			get
			{
				return _masobitich;
			}
			set
			{
				OnChanged(this, "MASOBITICH");
				_masobitich = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "MABITICH", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? MABITICH
		{
			get
			{
				return _mabitich;
			}
			set
			{
				OnChanged(this, "MABITICH");
				_mabitich = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "NGUOIDODAUID", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? NGUOIDODAUID
		{
			get
			{
				return _nguoidodauid;
			}
			set
			{
				OnChanged(this, "NGUOIDODAUID");
				_nguoidodauid = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MALINHMUC", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MALINHMUC
		{
			get
			{
				return _malinhmuc;
			}
			set
			{
				OnChanged(this, "MALINHMUC");
				_malinhmuc = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN
		{
			get
			{
				return _magiaodan;
			}
			set
			{
				OnChanged(this, "MAGIAODAN");
				_magiaodan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MALOPGIAOLY", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MALOPGIAOLY
		{
			get
			{
				return _malopgiaoly;
			}
			set
			{
				OnChanged(this, "MALOPGIAOLY");
				_malopgiaoly = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIADIEM", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIADIEM
		{
			get
			{
				return _diadiem;
			}
			set
			{
				OnChanged(this, "DIADIEM");
				_diadiem = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENLINHMUC", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENLINHMUC
		{
			get
			{
				return _tenlinhmuc;
			}
			set
			{
				OnChanged(this, "TENLINHMUC");
				_tenlinhmuc = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENNGUOIDODAU", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENNGUOIDODAU
		{
			get
			{
				return _tennguoidodau;
			}
			set
			{
				OnChanged(this, "TENNGUOIDODAU");
				_tennguoidodau = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NGAYNHAN", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NGAYNHAN
		{
			get
			{
				return _ngaynhan;
			}
			set
			{
				OnChanged(this, "NGAYNHAN");
				_ngaynhan = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "THANGNHAN", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? THANGNHAN
		{
			get
			{
				return _thangnhan;
			}
			set
			{
				OnChanged(this, "THANGNHAN");
				_thangnhan = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NAMNHAN", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NAMNHAN
		{
			get
			{
				return _namnhan;
			}
			set
			{
				OnChanged(this, "NAMNHAN");
				_namnhan = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 2000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "GHICHU", DbType = "nvarchar(2000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String GHICHU
		{
			get
			{
				return _ghichu;
			}
			set
			{
				OnChanged(this, "GHICHU");
				_ghichu = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "MASO", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? MASO
		{
			get
			{
				return _maso;
			}
			set
			{
				OnChanged(this, "MASO");
				_maso = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "LUUSO", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? LUUSO
		{
			get
			{
				return _luuso;
			}
			set
			{
				OnChanged(this, "LUUSO");
				_luuso = value;
			}
		}

		public BITICH PRT_BITICH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_bitich == default(BITICH)))
					InfoTech.Core.Data.Receiver.TypeObject<BITICH>.Select(this, "PRT_BITICH", new[] { new Vector<string, string>("MABITICH", "MABITICH"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_bitich;
			}
			set
			{
				_prt_bitich = value;
			}
		}

		public LINHMUC PRT_LINHMUC
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_linhmuc == default(LINHMUC)))
					InfoTech.Core.Data.Receiver.TypeObject<LINHMUC>.Select(this, "PRT_LINHMUC", new[] { new Vector<string, string>("MALINHMUC", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_linhmuc;
			}
			set
			{
				_prt_linhmuc = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(SOBITICH);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
